#!/bin/sh
# Check files before commit
#

function lintIt(){
	OUTPUT=$(git diff HEAD --cached --name-only | grep -E 'src\/.*\.js$')
	if [ "${OUTPUT}" != "" ];
  then
    e=$(eslint ${OUTPUT[@]})
    echo $e
    if [ "$e" != "" ];
    then
      echo "ERROR: Check eslint hints"
      exit 1 # reject
    fi
	fi
}

lintIt


